3.7 \(\int \frac{\sin ^2(x)}{a+b \cos (x)+c \cos ^2(x)} \, dx\)

Optimal. Leaf size=260 \[ \frac{2 \left (b-\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \sqrt{-\sqrt{b^2-4 a c}+b-2 c}}{\sqrt{-\sqrt{b^2-4 a c}+b+2 c}}\right )}{c \sqrt{-\sqrt{b^2-4 a c}+b-2 c} \sqrt{-\sqrt{b^2-4 a c}+b+2 c}}+\frac{2 \left (\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}+b\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \sqrt{\sqrt{b^2-4 a c}+b-2 c}}{\sqrt{\sqrt{b^2-4 a c}+b+2 c}}\right )}{c \sqrt{\sqrt{b^2-4 a c}+b-2 c} \sqrt{\sqrt{b^2-4 a c}+b+2 c}}-\frac{x}{c} \]

[Out]

-(x/c) + (2*(b - (b^2 - 2*c*(a + c))/Sqrt[b^2 - 4*a*c])*ArcTan[(Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Tan[x/2])/Sq
rt[b + 2*c - Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c - Sqrt[b^2 - 4*a*c]]) + (2
*(b + (b^2 - 2*c*(a + c))/Sqrt[b^2 - 4*a*c])*ArcTan[(Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Tan[x/2])/Sqrt[b + 2*c
+ Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c + Sqrt[b^2 - 4*a*c]])

________________________________________________________________________________________

Rubi [A]  time = 1.28412, antiderivative size = 260, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 4, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.21, Rules used = {3267, 3293, 2659, 205} \[ \frac{2 \left (b-\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \sqrt{-\sqrt{b^2-4 a c}+b-2 c}}{\sqrt{-\sqrt{b^2-4 a c}+b+2 c}}\right )}{c \sqrt{-\sqrt{b^2-4 a c}+b-2 c} \sqrt{-\sqrt{b^2-4 a c}+b+2 c}}+\frac{2 \left (\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}+b\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \sqrt{\sqrt{b^2-4 a c}+b-2 c}}{\sqrt{\sqrt{b^2-4 a c}+b+2 c}}\right )}{c \sqrt{\sqrt{b^2-4 a c}+b-2 c} \sqrt{\sqrt{b^2-4 a c}+b+2 c}}-\frac{x}{c} \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]^2/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

-(x/c) + (2*(b - (b^2 - 2*c*(a + c))/Sqrt[b^2 - 4*a*c])*ArcTan[(Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Tan[x/2])/Sq
rt[b + 2*c - Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c - Sqrt[b^2 - 4*a*c]]) + (2
*(b + (b^2 - 2*c*(a + c))/Sqrt[b^2 - 4*a*c])*ArcTan[(Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Tan[x/2])/Sqrt[b + 2*c
+ Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c + Sqrt[b^2 - 4*a*c]])

Rule 3267

Int[((a_.) + cos[(d_.) + (e_.)*(x_)]^(n_.)*(b_.) + cos[(d_.) + (e_.)*(x_)]^(n2_.)*(c_.))^(p_.)*sin[(d_.) + (e_
.)*(x_)]^(m_.), x_Symbol] :> Int[ExpandTrig[(1 - cos[d + e*x]^2)^(m/2)*(a + b*cos[d + e*x]^n + c*cos[d + e*x]^
(2*n))^p, x], x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[n2, 2*n] && IntegerQ[m/2] && NeQ[b^2 - 4*a*c, 0] && Integ
ersQ[n, p]

Rule 3293

Int[(cos[(d_.) + (e_.)*(x_)]*(B_.) + (A_))/((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + cos[(d_.) + (e_.)*(x_)]^2*
(c_.)), x_Symbol] :> Module[{q = Rt[b^2 - 4*a*c, 2]}, Dist[B + (b*B - 2*A*c)/q, Int[1/(b + q + 2*c*Cos[d + e*x
]), x], x] + Dist[B - (b*B - 2*A*c)/q, Int[1/(b - q + 2*c*Cos[d + e*x]), x], x]] /; FreeQ[{a, b, c, d, e, A, B
}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\sin ^2(x)}{a+b \cos (x)+c \cos ^2(x)} \, dx &=\int \left (-\frac{1}{c}+\frac{a \left (1+\frac{c}{a}\right )+b \cos (x)}{c \left (a+b \cos (x)+c \cos ^2(x)\right )}\right ) \, dx\\ &=-\frac{x}{c}+\frac{\int \frac{a \left (1+\frac{c}{a}\right )+b \cos (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx}{c}\\ &=-\frac{x}{c}+\frac{\left (b-\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \int \frac{1}{b-\sqrt{b^2-4 a c}+2 c \cos (x)} \, dx}{c}+\frac{\left (b+\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \int \frac{1}{b+\sqrt{b^2-4 a c}+2 c \cos (x)} \, dx}{c}\\ &=-\frac{x}{c}+\frac{\left (2 \left (b-\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b+2 c-\sqrt{b^2-4 a c}+\left (b-2 c-\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{c}+\frac{\left (2 \left (b+\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b+2 c+\sqrt{b^2-4 a c}+\left (b-2 c+\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{c}\\ &=-\frac{x}{c}+\frac{2 \left (b-\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\sqrt{b-2 c-\sqrt{b^2-4 a c}} \tan \left (\frac{x}{2}\right )}{\sqrt{b+2 c-\sqrt{b^2-4 a c}}}\right )}{c \sqrt{b-2 c-\sqrt{b^2-4 a c}} \sqrt{b+2 c-\sqrt{b^2-4 a c}}}+\frac{2 \left (b+\frac{b^2-2 c (a+c)}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\sqrt{b-2 c+\sqrt{b^2-4 a c}} \tan \left (\frac{x}{2}\right )}{\sqrt{b+2 c+\sqrt{b^2-4 a c}}}\right )}{c \sqrt{b-2 c+\sqrt{b^2-4 a c}} \sqrt{b+2 c+\sqrt{b^2-4 a c}}}\\ \end{align*}

Mathematica [A]  time = 0.618093, size = 238, normalized size = 0.92 \[ \frac{x \left (-\sqrt{b^2-4 a c}\right )-\frac{\left (b \sqrt{b^2-4 a c}-2 c (a+c)+b^2\right ) \tanh ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b-2 c\right )}{\sqrt{-2 b \sqrt{b^2-4 a c}+4 c (a+c)-2 b^2}}\right )}{\sqrt{-\frac{1}{2} b \sqrt{b^2-4 a c}+c (a+c)-\frac{b^2}{2}}}+\sqrt{2 b \sqrt{b^2-4 a c}+4 c (a+c)-2 b^2} \tanh ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}-b+2 c\right )}{\sqrt{2 b \sqrt{b^2-4 a c}+4 c (a+c)-2 b^2}}\right )}{c \sqrt{b^2-4 a c}} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]^2/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

(-(Sqrt[b^2 - 4*a*c]*x) - ((b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c])*ArcTanh[((b - 2*c + Sqrt[b^2 - 4*a*c])*Ta
n[x/2])/Sqrt[-2*b^2 + 4*c*(a + c) - 2*b*Sqrt[b^2 - 4*a*c]]])/Sqrt[-b^2/2 + c*(a + c) - (b*Sqrt[b^2 - 4*a*c])/2
] + Sqrt[-2*b^2 + 4*c*(a + c) + 2*b*Sqrt[b^2 - 4*a*c]]*ArcTanh[((-b + 2*c + Sqrt[b^2 - 4*a*c])*Tan[x/2])/Sqrt[
-2*b^2 + 4*c*(a + c) + 2*b*Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b^2 - 4*a*c])

________________________________________________________________________________________

Maple [B]  time = 0.044, size = 1157, normalized size = 4.5 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/(a+b*cos(x)+c*cos(x)^2),x)

[Out]

1/c*a/(((-4*a*c+b^2)^(1/2)+a-c)*(a-b+c))^(1/2)*arctan((a-b+c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2)+a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))^(1/2)*arctanh((-
a+b-c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2))-1/c/(-4*a*c+b^2)^(1/2)/(((-4*a*c+b^2)^(1/2)-a+c)*(
a-b+c))^(1/2)*arctanh((-a+b-c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2))*b^2-b/(-4*a*c+b^2)^(1/2)/(
((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2)*arctanh((-a+b-c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2))+
1/(((-4*a*c+b^2)^(1/2)+a-c)*(a-b+c))^(1/2)*arctan((a-b+c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2)+a-c)*(a-b+c))^(1/2))
-2*c/(-4*a*c+b^2)^(1/2)/(((-4*a*c+b^2)^(1/2)+a-c)*(a-b+c))^(1/2)*arctan((a-b+c)*tan(1/2*x)/(((-4*a*c+b^2)^(1/2
)+a-c)*(a-b+c))^(1/2))+1/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2)*arctanh((-a+b-c)*tan(1/2*x)/(((-4*a*c+b^2)^(
1/2)-a+c)*(a-b+c))^(1/2))+2*c/(-4*a*c+b^2)^(1/2)/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2)*arctanh((-a+b-c)*tan
(1/2*x)/(((-4*a*c+b^2)^(1/2)-a+c)*(a-b+c))^(1/2))-2/c*arctan(tan(1/2*x))

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cos(x)+c*cos(x)^2),x, algorithm="maxima")

[Out]

(c*integrate(2*(2*b^2*cos(3*x)^2 + 2*b^2*cos(x)^2 + 2*b^2*sin(3*x)^2 + 2*b^2*sin(x)^2 + 4*(2*a^2 + 3*a*c + c^2
)*cos(2*x)^2 + b*c*cos(x) + 4*(2*a^2 + 3*a*c + c^2)*sin(2*x)^2 + 2*(4*a*b + 3*b*c)*sin(2*x)*sin(x) + (b*c*cos(
3*x) + b*c*cos(x) + 2*(a*c + c^2)*cos(2*x))*cos(4*x) + (4*b^2*cos(x) + b*c + 2*(4*a*b + 3*b*c)*cos(2*x))*cos(3
*x) + 2*(a*c + c^2 + (4*a*b + 3*b*c)*cos(x))*cos(2*x) + (b*c*sin(3*x) + b*c*sin(x) + 2*(a*c + c^2)*sin(2*x))*s
in(4*x) + 2*(2*b^2*sin(x) + (4*a*b + 3*b*c)*sin(2*x))*sin(3*x))/(c^3*cos(4*x)^2 + 4*b^2*c*cos(3*x)^2 + 4*b^2*c
*cos(x)^2 + c^3*sin(4*x)^2 + 4*b^2*c*sin(3*x)^2 + 4*b^2*c*sin(x)^2 + 4*b*c^2*cos(x) + c^3 + 4*(4*a^2*c + 4*a*c
^2 + c^3)*cos(2*x)^2 + 4*(4*a^2*c + 4*a*c^2 + c^3)*sin(2*x)^2 + 8*(2*a*b*c + b*c^2)*sin(2*x)*sin(x) + 2*(2*b*c
^2*cos(3*x) + 2*b*c^2*cos(x) + c^3 + 2*(2*a*c^2 + c^3)*cos(2*x))*cos(4*x) + 4*(2*b^2*c*cos(x) + b*c^2 + 2*(2*a
*b*c + b*c^2)*cos(2*x))*cos(3*x) + 4*(2*a*c^2 + c^3 + 2*(2*a*b*c + b*c^2)*cos(x))*cos(2*x) + 4*(b*c^2*sin(3*x)
 + b*c^2*sin(x) + (2*a*c^2 + c^3)*sin(2*x))*sin(4*x) + 8*(b^2*c*sin(x) + (2*a*b*c + b*c^2)*sin(2*x))*sin(3*x))
, x) - x)/c

________________________________________________________________________________________

Fricas [B]  time = 2.46882, size = 1987, normalized size = 7.64 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cos(x)+c*cos(x)^2),x, algorithm="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^4 - 4*a*c^5))*cos(x) - 2*b*c) - s
qrt(2)*c*sqrt(-(b^2 - 2*a*c - 2*c^2 - (b^2*c^2 - 4*a*c^3)*sqrt(b^2/(b^2*c^4 - 4*a*c^5)))/(b^2*c^2 - 4*a*c^3))*
log(-sqrt(2)*(b^2*c^3 - 4*a*c^4)*sqrt(b^2/(b^2*c^4 - 4*a*c^5))*sqrt(-(b^2 - 2*a*c - 2*c^2 - (b^2*c^2 - 4*a*c^3
)*sqrt(b^2/(b^2*c^4 - 4*a*c^5)))/(b^2*c^2 - 4*a*c^3))*sin(x) - b^2*cos(x) + (b^2*c^2 - 4*a*c^3)*sqrt(b^2/(b^2*
c^4 - 4*a*c^5))*cos(x) - 2*b*c) + 4*x)/c

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)**2/(a+b*cos(x)+c*cos(x)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/(a+b*cos(x)+c*cos(x)^2),x, algorithm="giac")

[Out]

Timed out